<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <!-- 判断一个数字是否可以表示成三的幂的和 -->
    <script>
      function checkPowersOfThree(n) {
        while (n) {
          if (n % 3 === 2) return false
          n = Math.floor(n / 3)
        }
        return true
      }
      console.log(checkPowersOfThree(12))
    </script>
  </body>
</html>
